import Http from "@/utils/http.js";
import {exp} from "three/tsl";

/**
 * 提交文本，生成模型任务
 * @param text
 * @param modelName
 * @param enablePBR
 * @param faceCount
 * @param modelType
 * @returns {Promise<axios.AxiosResponse<any>>}
 * @constructor
 */
export function RequestSubmitHunyuanModelJobByText(text,modelName, enablePBR, faceCount, modelType){
    return Http.post('/api/protected/user/hunyuan/submit/text',{
        imageGen:false,
        modelName:modelName,
        text:text,
        enablePBR:enablePBR,
        faceCount:faceCount,
        generateType:modelType
    });
}

/**
 * 提交图片，生成模型任务
 * @param images
 * @param modelName
 * @param enablePBR
 * @param faceCount
 * @param modelType
 * @returns {Promise<axios.AxiosResponse<any>>}
 * @constructor
 */
export function RequestSubmitHunyuanModelJobByImage(images, modelName, enablePBR, faceCount, modelType){
    return Http.post('/api/protected/user/hunyuan/submit/image',{
        imageGen:true,
        modelName:modelName,
        images:images,
        enablePBR:enablePBR,
        faceCount:faceCount,
        generateType:modelType
    });
}


/**
 * 查询模型任务
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 * @constructor
 */
export function RequestQueryHunyuanModelJob(data){
    return Http.get('/api/protected/user/hunyuan/query?id='+data);
}

/**
 * 获取用户提交的模型任务列表
 * @returns {Promise<axios.AxiosResponse<any>>}
 * @constructor
 */
export function RequestListJobs(){
    return Http.get('/api/protected/user/job/list');
}

/**
 * 删除模型任务
 * @param id 任务id
 * @returns {*}
 * @constructor
 */
export function RequestDeleteJob(id){
    return Http.post('/api/protected/user/job/delete?id='+id);
}

/**
 * 重新提交模型任务,模型任务失败时使用
 * @param id
 * @returns {Promise<axios.AxiosResponse<any>>}
 * @constructor
 */
export function RequestSubmitRetryJob(id){
    return Http.post('/api/protected/user/hunyuan/submit/retry?id='+id);
}

/**
 * AI搜索模型任务，用于减少模型调用次数
 * @param target
 * @returns {Promise<axios.AxiosResponse<any>>}
 * @constructor
 */
export function RequestSearchJobByAI(target){
    return Http.get('/api/public/user/search/ai?target='+target);
}

/**
 * 模型任务添加到我的模型
 * @param id
 * @returns {Promise<axios.AxiosResponse<any>>}
 * @constructor
 */
export function RequestSubmitJobToMine(id){
    return Http.post('/api/protected/user/job/addToMine?id='+id);
}

